﻿@model Everynet.PlanQuota
@{
    ViewBag.Title = "CreatePlanQuota";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<h2>
    CreatePlanQuota</h2>
<p>
    @Html.ActionLink("Dashboard", "Dashboard", "Admin")
</p>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true, "Please correct the errors and try again.")
    <fieldset>
        <legend>Create PlanQuota</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.PlanQuotaValue)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.PlanQuotaValue, new { maxlength = "5" })
            @Html.ValidationMessageFor(model => model.PlanQuotaValue)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.PlanQuotaInterval)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.PlanQuotaInterval, new { maxlength = "10" })
            @Html.ValidationMessageFor(model => model.PlanQuotaInterval)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.SetupCost)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.SetupCost, new { maxlength = "30" })
            @Html.ValidationMessageFor(model => model.SetupCost)
        </div>

       <div class="editor-label">
            @Html.LabelFor(model => model.PlanNamesID)
        </div>
         <div class="editor-field">
            @Html.DropDownList("PlanNamesID")
        </div>

         <div id="PlannamesDetailDivID" class="editor-label">
            
             @Html.LabelFor(model => model.PlanNamesDetailID)
        </div>
        <div class="editor-field">
         @Html.DropDownList("PlanNamesDetailID")
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EarlyExitFee)
        </div>
          <div class="editor-field">
            @Html.TextBoxFor(model => model.EarlyExitFee, new { maxlength = "30" })
            @Html.ValidationMessageFor(model => model.EarlyExitFee)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Comment)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Comment, new { maxlength = "50" })
            @Html.ValidationMessageFor(model => model.Comment)
        </div>


         <div class="editor-label">
            Public Visible:  @Html.CheckBoxFor(model => model.VisiblePublic)
        </div>

       

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}<div>
        @Html.ActionLink("Back to List", "PlanQuota")
    </div>
    <script type="text/javascript">
    $(function () {
        $('#PlanNamesID').change(function () {
        var abbr = $("#PlanNamesID").val();
             getdetail(abbr);
        });


        function getdetail(abbr) {
        $.ajax({
            url: "@Url.Action("getDetail", "Admin")",
            data: {ID: abbr},
            dataType: "json",
            type: "POST",
            error: function() {
                alert("An error occurred.");
            },
            success: function(data) {
                var items = "";
                $.each(data, function(i, item) {
                    items += "<option value=\"" + item.Value + "\">" + item.Text + "</option>";
                });

                $("#PlanNamesDetailID").html(items);
            }
        });
    }
    });
    </script>